#pragma once

#include "RBTree.h"

namespace Aron
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};

	public:
		typedef typename RBTree<K, const K, SetKeyOfT>::iterator iterator;
		typedef typename RBTree<K, const K, SetKeyOfT>::const_iterator const_iterator;
		typedef typename RBTree<K, const K, SetKeyOfT>::reverse_iterator reverse_iterator;
		typedef typename RBTree<K, const K, SetKeyOfT>::const_reverse_iterator const_reverse_iterator;

		iterator begin()
		{
			return _set.begin();
		}

		iterator end()
		{
			return _set.end();
		}

		const_iterator begin() const
		{
			return _set.begin();
		}

		const_iterator end() const
		{
			return _set.end();
		}

		reverse_iterator rbegin()
		{
			return _set.rbegin();
		}

		reverse_iterator rend()
		{
			return _set.rend();
		}

		const_reverse_iterator rbegin() const
		{
			return _set.rbegin();
		}

		const_reverse_iterator rend() const
		{
			return _set.rend();
		}

		bool Empty() const
		{
			return _set.Empty();
		}

		size_t Size() const
		{
			return _set.Size();
		}

		size_t Count(const K& key) const
		{
			return _set.Count(key);
		}

		bool insert(const K& key)
		{
			return _set.Insert(key);
		}

		bool find(const K& key)
		{
			return _set.Find(key);
		}

	private:
		RBTree<K, const K, SetKeyOfT> _set;
	};

	//void test_set1()
	//{
	//	set<int> s;
	//	int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	//	for (auto e : a)
	//	{
	//		s.insert(e);
	//	}

	//	set<int>::iterator it = s.begin();
	//	while (it != s.end())
	//	{
	//		//if(*it % 2 == 0)
	//		//	*it += 100;

	//		cout << *it << " ";
	//		++it;
	//	}
	//	cout << endl;
	//}
}
